# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=parted
pkgver=3.6
pkgrel=2
pkgdesc="Utility to create, destroy, resize, check and copy partitions"
url="https://www.gnu.org/software/parted/parted.html"
arch="all"
license="GPL-3.0-or-later"
makedepends="
	bash
	lvm2-dev
	ncurses-dev
	readline-dev
	util-linux-dev
	"
checkdepends="
	coreutils
	eudev
	perl
	util-linux
	"
subpackages="$pkgname-dev $pkgname-doc"
source="https://ftp.gnu.org/gnu/parted/parted-$pkgver.tar.xz
	fix-includes.patch
	fix-libintl-header-s390x.patch
	parted-include-sysmacros.patch
	fix-truncate-tests.patch
	make-tests.patch
	skip-duplicate-bsd-test-on-s390x.patch
	"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-debug \
		--disable-nls \
		--disable-static \
		--enable-shared
	make
}

check() {
	make check || {
		cat tests/test-suite.log
		return 1
	}
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
034a44b25718acba175212019d24f092972a791c5bd1d921ae91e17478657a77c5c5dd0c832bed7968c3a07ec6c65c0785acfac2f90c1ca5e1692f3c141693ef  parted-3.6.tar.xz
55ee63c218d1867c0f2c596e7c3eec5c42af160181456cc551fe3d432eabed0ac2dd3a3955ff0c375f76aeec8071e7f55a32834b87a0d39b8ef30361f671bfdd  fix-includes.patch
444a7e2fb3235dfd218f6b71fb25adde107d001f638d988ee1fa79686d8efee94a9499e27bdfdd75f9718760b448938b70a90a74285b93a39338d21f4ab4c9dc  fix-libintl-header-s390x.patch
ba86cd2591d8e920e474faf28a32f9eaca9482e168c53eae5d392276aefaf6c46b66a0d5fc4a18b7186bf38f7288bd79de8ba8019c1cd38a5e2102904ce75723  parted-include-sysmacros.patch
cca125b891739fd65c38a05638105ea15f77a71b9780af891bb56523b67e9ec3188be18109c3166be445bc03409de85d09e994d7dbbe13d663312df7dda2a2fa  fix-truncate-tests.patch
8bf7fce435092baba6855cefca75b701124941741417e2f7f5b78f68da5c0f33013232b411fa04b3532c37c347d75bbfa9279221985d0f0080d1b2a48863e6c1  make-tests.patch
42120158f44705b416162edd5e2d61635d34ff88878d84fc8110a169fd927ec3d714376a52e60e55d041e80afd8edad6429b1b5897e0738d23c6583a7bfc09bc  skip-duplicate-bsd-test-on-s390x.patch
"
